/*
 * =====================================================================================
 *
 *       Filename:  utility.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2012年03月09日 17时52分28秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Regan (), lcqhigh@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */
#ifndef  utility_INC
#define  utility_INC

#include	<stdlib.h>
#include	<string.h>

#include	<stdio.h>
#include	<assert.h>
#include	<ctype.h>

static void genRandInt(int arr[], int n)
{
    int i = 0;
    for (i = 0; i < n; ++i)
        arr[i] = rand();
}

static void printIntarr(int arr[], int n)
{
    int i;
    for (i = 0; i < n; ++i)
    {
        printf ( "%d  ", arr[i]);
        if ((i+1)%10 == 0)
            printf ( "\n" );
    }
    printf ( "\n" );
    return;
}

static int genString(char str[], int n)
{
    int len = rand() % n;
    if (len == 0) ++len;
    memset(str, '\0', n);
    char *p = str;
    while (len) 
    {
        char c = rand() % 128;
        if (ispunct(c))
        {
            *p++ = c;
            --len;
        }
    }
    return 0;
}

#endif   /* ----- #ifndef utility_INC  ----- */
